package moodish.message;

import java.io.Serializable;

import moodish.comm.ClientSideMessage;


/**
 * Message sent from a Server to a Client. 
 * Implements ClientSideMessage and this object will be sent to the Client using ObjectOutputStream().
 * In the same way the Client will receive this object using ObjectInputStream().
 *  
 */
@SuppressWarnings("serial")
public class MessageFromServer implements ClientSideMessage, Serializable {
	private Type type;
	private String sendersNickname;
	private String destination;
	private String data;
	
	public MessageFromServer(Type type, String nickname, String destination, String data)
	{
		this.type = type;
		this.sendersNickname = nickname;
		this.destination=destination;
		this.data=data;
	}

	@Override
	public Type getType() {
		return this.type;
	}

	@Override
	public String getSendersNickname() {
		return this.sendersNickname;
	}
	
	public String toString()
	{
		return this.type + " " + this.sendersNickname + " " + this.destination + " " + this.data;
	}

	@Override
	public String getPayload() {
		// TODO Auto-generated method stub
		return this.data;
	}
}
